const TokenKey = 'token'

export function getToken() {
	return uni.getStorageSync(TokenKey)
}

export function setToken(token) {
	return uni.setStorageSync(TokenKey, token)
}

export function removeToken() {
	return uni.removeStorageSync(TokenKey)
}

export function getTokenSync() {
	return new Promise((resolve, reject) => {
		uni.getStorage({
			key: TokenKey,
			fail(err) {
				reject(err)
			},
			success: function(res) {
				resolve(res)
			}
		})
	})
}
